#include <stdio.h>
#include <math.h>

int IsTheNumber ( const int N );

int main()
{
    int n1, n2, i, cnt;

    scanf("%d %d", &n1, &n2);
    cnt = 0;
    for ( i=n1; i<=n2; i++ ) {
        if ( IsTheNumber(i) )
            cnt++;
    }
    printf("cnt = %d\n", cnt);

    return 0;
}

/* 你的代码将被嵌在这里 */
int IsTheNumber ( const int N )
{
    char s[100];
    char f[10]={0,0,0,0,0,0,0,0,0,0};
    bool flag=0;
    sprintf(s,"%d",N);
    for(int i=0;s[i];++i)
        if(f[s[i]-'0'])
        {
            flag=1;
            break;
        }
        else
            f[s[i]-'0']=1;
    int x=sqrt(N);
    return (x*x==N)&&flag;
}